// set.cpp
// Set, a collection of items.
//
// Copyright (C) 2008  Maksim Sipos <msipos@mailc.net>
//
// This file is a part of the Ripe language project.
//
// Ripe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#include "adts/set.hpp"

namespace Ripe {

template <class T>
bool Set<T>::get(T element, T* out)
{
  return map.get(element, out);
}

template <class T>
T Set<T>::get(T element) throw(ErrorKey)
{
  return map.get(element);
}

template <class T>
bool Set<T>::has(T element)
{
  T out;
  return map.get(element, &out);
}

template <class T>
bool Set<T>::set(T element)
{
  return map.set(element, element);
}

template <class T>
SetIterator<T>::SetIterator(Set<T>* s)
{
  iter.reset(&(s->map));
}
      
template <class T>
bool SetIterator<T>::has_more()
{
  return iter.has_more();
}
      
template <class T>
T SetIterator<T>::get()
{
  T key, value;
  iter.get(&key, &value);
  return key;
}

}

